TensorFlow 2.0 Quick Start Guide by Tony Holdroyd

TensorFlow 2.0 Quick Start Guide by Tony Holdroyd

Author:Tony Holdroyd
Language: eng
Format: epub
Tags: COM044000 - COMPUTERS / Neural Networks, COM018000 - COMPUTERS / Data Processing, COM062000 - COMPUTERS / Data Modeling and Design
Publisher: Packt Publishing
Published: 2019-03-28T15:52:48+00:00


import numpy as np

import matplotlib.pyplot as plt

%matplotlib inline

Preprocessing the data

Then, we load the data. For this application, we will use the fashion_mnist dataset, which was designed as a drop-in replacement for the famous MNIST dataset. There are examples of these images toward the end of this section. Each data item (pixel in the image) is an unsigned integer in the range 0 to 255, so we first convert it into float32, and then scale it into the range zero to one to make it amenable to the learning process later:

(x_train, _), (x_test, _) = fashion_mnist.load_data() # we don't need the labels

x_train = x_train.astype('float32') / 255. # normalize

x_test = x_test.astype('float32') / 255.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.